package com.caogt.common.restful;

import lombok.Data;

@Data
public class ResultData<T> {
    private boolean flag;
    private String msg;
    private T data;

    public ResultData(boolean flag, String msg, T data) {
        this.flag = flag;
        this.msg = msg;
        this.data = data;
    }

    public ResultData(boolean flag, String msg) {
        this.flag = flag;
        this.msg = msg;
    }

    public ResultData() {
    }

    public static ResultData success(){
        return new ResultData(true,null,null);
    }
    public static <T>ResultData success(T data){
        return new ResultData(true,null,data);
    }
    public static ResultData fail(String msg){
        return new ResultData(false,msg,null);
    }
}
